#ifndef _PARAMETER_CONFIG_H_
#define _PARAMETER_CONFIG_H_

#include "config.h"

union sw { 
	unsigned int value;
	unsigned char buf[4];
};

/*Terminal parameter define*/
typedef struct{
	char device_model[20];
	char manufacturer[20];
	char software_version[10];
	char hardware_version[10];
}terminalInformationItem;

//video parameter struct define
typedef struct{
	unsigned char video_distinguishability; //distinguishability
	unsigned char system;               //system
	unsigned char frame_rate;           //frame rate
	unsigned char quality;              //quality
	unsigned char I_frame_interval;    //I frame interval
	unsigned char code_stream;         //code_stream
	unsigned char brightness;           //brightness
	unsigned char chromaticity;         //chromaticity
	unsigned char saturation;           //saturation
	unsigned char contrast;             //contrast
	unsigned char gray_scale_switch;    //gray scale switch
}videoItem;

//record format struct define
typedef struct{
    unsigned char rf_recorder_switch;
    unsigned char rf_distinguishability;
    unsigned char rf_frame_rate;
    unsigned char rf_code_stream;
    unsigned char rf_quality;
    unsigned char rf_osd_switch;
    unsigned char rf_pack_flag;
    unsigned char rf_model;
    unsigned char rf_audio_composite_switch;
}recordFormatItem;

//ptz parameter struct define
typedef struct{
    unsigned char ptz_switch;
    unsigned char ptz_protocol;
    unsigned char ptz_baud_rate;
    unsigned char ptz_set_wiper;
}ptzItem;

typedef struct{
	unsigned char rs_recorder_addr;
	unsigned char rs_snap_addr;
	unsigned char rs_cover_strategy;
	unsigned char rs_alarm_cover_strategy;
	unsigned char rs_recorder_channel;
	char rs_recorder_time_start[20];
	char rs_recorder_time_end[20];
	unsigned char rs_recorder_type;
	unsigned char rs_recorder_source;
}recordStorageItem;

typedef struct{
	unsigned short cmd_port;
	unsigned short data_port;
	unsigned short ftp_port;
	char server_ip[20];
	char server_dns[20];
	char server_gateway[20];
}netItem;

//osd parameter struct define
typedef struct{
unsigned char osd_time_switch;
unsigned char osd_gps_switch;
unsigned char osd_switch_1;
unsigned char osd_color_1;
unsigned char osd_font_size_1;
char osd_content_1[200];
unsigned char osd_switch_2;
unsigned char osd_color_2;
unsigned char osd_font_size_2;
char osd_content_2[200];
}osdItem;

class Parameter_config
{

	public:
		pthread_mutex_t read_write_lock;/*read and write lock*/
		
		//ID: 0x0***
		//terminal information parameter
		unsigned char device_model[20];
		unsigned char manufacturer[20];
		unsigned char software_version[10];
		unsigned char hardware_version[10];

		//ID: 0x1***
		//video parameter (1-4 channel for each)
		unsigned char video_distinguishability_1;
		unsigned char video_distinguishability_2;
		unsigned char video_distinguishability_3;
		unsigned char video_distinguishability_4;
		unsigned char video_system_1;
		unsigned char video_system_2;
		unsigned char video_system_3;
		unsigned char video_system_4;
		unsigned char video_frame_rate_1;
		unsigned char video_frame_rate_2;
		unsigned char video_frame_rate_3;
		unsigned char video_frame_rate_4;
		unsigned char video_I_frame_interval_1;
		unsigned char video_I_frame_interval_2;
		unsigned char video_I_frame_interval_3;
		unsigned char video_I_frame_interval_4;
		unsigned char video_quality_1;
		unsigned char video_quality_2;
		unsigned char video_quality_3;
		unsigned char video_quality_4;
		unsigned char video_code_stream_1;
		unsigned char video_code_stream_2;
		unsigned char video_code_stream_3;
		unsigned char video_code_stream_4;
		unsigned char video_gray_scale_switch_1;
		unsigned char video_gray_scale_switch_2;
		unsigned char video_gray_scale_switch_3;
		unsigned char video_gray_scale_switch_4;
		unsigned char video_brightness_1;
		unsigned char video_brightness_2;
		unsigned char video_brightness_3;
		unsigned char video_brightness_4;
		unsigned char video_chromaticity_1;
		unsigned char video_chromaticity_2;
		unsigned char video_chromaticity_3;
		unsigned char video_chromaticity_4;
		unsigned char video_saturation_1;
		unsigned char video_saturation_2;
		unsigned char video_saturation_3;
		unsigned char video_saturation_4;
		unsigned char video_contrast_1;
		unsigned char video_contrast_2;
		unsigned char video_contrast_3;
		unsigned char video_contrast_4;

		//ID : 0x2***
		//region cover parameter
		unsigned char rc_cover_flag_1;
		unsigned char rc_color_1;
		unsigned short rc_x_1;
		unsigned short rc_y_1;
		unsigned short rc_h_1;
		unsigned short rc_w_1;
		unsigned char rc_cover_flag_2;
		unsigned char rc_color_2;
		unsigned short rc_x_2;
		unsigned short rc_y_2;
		unsigned short rc_h_2;
		unsigned short rc_w_2;
		unsigned char rc_cover_flag_3;
		unsigned char rc_color_3;
		unsigned short rc_x_3;
		unsigned short rc_y_3;
		unsigned short rc_h_3;
		unsigned short rc_w_3;
		unsigned char rc_cover_flag_4;
		unsigned char rc_color_4;
		unsigned short rc_x_4;
		unsigned short rc_y_4;
		unsigned short rc_h_4;
		unsigned short rc_w_4;

		//ID : 0x3***
		//move detect parameter
		unsigned char md_switch_1;
		unsigned char md_switch_time_1;
		unsigned char md_light_effect_switch_1;
		unsigned char md_sensitivity_1;
		unsigned short md_x_1;
		unsigned short md_y_1;
		unsigned short md_h_1;
		unsigned short md_w_1;
		unsigned char md_switch_2;
		unsigned char md_switch_time_2;
		unsigned char md_light_effect_switch_2;
		unsigned char md_sensitivity_2;
		unsigned short md_x_2;
		unsigned short md_y_2;
		unsigned short md_h_2;
		unsigned short md_w_2;
		unsigned char md_switch_3;
		unsigned char md_switch_time_3;
		unsigned char md_light_effect_switch_3;
		unsigned char md_sensitivity_3;
		unsigned short md_x_3;
		unsigned short md_y_3;
		unsigned short md_h_3;
		unsigned short md_w_3;
		unsigned char md_switch_4;
		unsigned char md_switch_time_4;
		unsigned char md_light_effect_switch_4;
		unsigned char md_sensitivity_4;
		unsigned short md_x_4;
		unsigned short md_y_4;
		unsigned short md_h_4;
		unsigned short md_w_4;

		//ID : 0x4***
		//snap parameter
		unsigned char snap_quality_1;
		unsigned short snap_distinguishability_1;
		unsigned char snap_quality_2;
		unsigned short snap_distinguishability_2;
		unsigned char snap_quality_3;
		unsigned short snap_distinguishability_3;
		unsigned char snap_quality_4;
		unsigned short snap_distinguishability_4;
		
		//ID : 0x5***
		//osd parameter
		unsigned char osd_time_switch_1;
		unsigned char osd_gps_switch_1;
		unsigned char osd_switch_1_1;
		unsigned char osd_color_1_1;
		unsigned char osd_font_size_1_1;
		unsigned char osd_content_1_1[100];
		unsigned char osd_switch_1_2;
		unsigned char osd_color_1_2;
		unsigned char osd_font_size_1_2;
		unsigned char osd_content_1_2[100];
		unsigned char osd_time_switch_2;
		unsigned char osd_gps_switch_2;
		unsigned char osd_switch_2_1;
		unsigned char osd_color_2_1;
		unsigned char osd_font_size_2_1;
		unsigned char osd_content_2_1[100];
		unsigned char osd_switch_2_2;
		unsigned char osd_color_2_2;
		unsigned char osd_font_size_2_2;
		unsigned char osd_content_2_2[100];
		unsigned char osd_time_switch_3;
		unsigned char osd_gps_switch_3;
		unsigned char osd_switch_3_1;
		unsigned char osd_color_3_1;
		unsigned char osd_font_size_3_1;
		unsigned char osd_content_3_1[100];
		unsigned char osd_switch_3_2;
		unsigned char osd_color_3_2;
		unsigned char osd_font_size_3_2;
		unsigned char osd_content_3_2[100];
		unsigned char osd_time_switch_4;
		unsigned char osd_gps_switch_4;
		unsigned char osd_switch_4_1;
		unsigned char osd_color_4_1;
		unsigned char osd_font_size_4_1;
		unsigned char osd_content_4_1[100];
		unsigned char osd_switch_4_2;
		unsigned char osd_color_4_2;
		unsigned char osd_font_size_4_2;
		unsigned char osd_content_4_2[100];

		//ID : 0x6***
		//audio parameter
		unsigned char audio_channel_flag_1;
		unsigned char audio_sample_precision_1;
		unsigned char audio_sample_rate_1;
		//unsigned char aodio_code_stream_1;
		unsigned char audio_channel_flag_2;
		unsigned char audio_sample_precision_2;
		unsigned char audio_sample_rate_2;
		//unsigned char aodio_code_stream_2;
		unsigned char audio_channel_flag_3;
		unsigned char audio_sample_precision_3;
		unsigned char audio_sample_rate_3;
		//unsigned char aodio_code_stream_3;
		unsigned char audio_channel_flag_4;
		unsigned char audio_sample_precision_4;
		unsigned char audio_sample_rate_4;
		//unsigned char aodio_code_stream_4;

		//ID : 0x7***
		//record storage parameter
		unsigned char rs_recorder_addr;
		unsigned char rs_snap_addr;
		unsigned char rs_storage_status;
		unsigned char rs_cover_strategy;
		unsigned char rs_alarm_cover_strategy;
		unsigned char rs_recorder_channel;
		char rs_recorder_time_start[20];
		char rs_recorder_time_end[20];
		unsigned char rs_recorder_type;
		unsigned char rs_recorder_source;
		
		//ID : 0x8***
		//record form parameter
		unsigned char rf_recorder_switch_1;
		unsigned char rf_distinguishability_1;
		unsigned char rf_frame_rate_1;
		unsigned char rf_code_stream_1;
		unsigned char rf_quality_1;
		unsigned char rf_osd_switch_1;
		unsigned char rf_pack_flag_1;
		unsigned char rf_model_1;
		unsigned char rf_audio_composite_switch_1;
		unsigned char rf_recorder_switch_2;
		unsigned char rf_distinguishability_2;
		unsigned char rf_frame_rate_2;
		unsigned char rf_code_stream_2;
		unsigned char rf_quality_2;
		unsigned char rf_osd_switch_2;
		unsigned char rf_pack_flag_2;
		unsigned char rf_model_2;
		unsigned char rf_audio_composite_switch_2;
		unsigned char rf_recorder_switch_3;
		unsigned char rf_distinguishability_3;
		unsigned char rf_frame_rate_3;
		unsigned char rf_code_stream_3;
		unsigned char rf_quality_3;
		unsigned char rf_osd_switch_3;
		unsigned char rf_pack_flag_3;
		unsigned char rf_model_3;
		unsigned char rf_audio_composite_switch_3;
		unsigned char rf_recorder_switch_4;
		unsigned char rf_distinguishability_4;
		unsigned char rf_frame_rate_4;
		unsigned char rf_code_stream_4;
		unsigned char rf_quality_4;
		unsigned char rf_osd_switch_4;
		unsigned char rf_pack_flag_4;
		unsigned char rf_model_4;
		unsigned char rf_audio_composite_switch_4;

		//ID : 0x9***
		//alarm parameter
		unsigned char video_loss_switch;
		unsigned char encoder_exception_switch;
		unsigned char ptz_failure_switch;
		unsigned char video_shielding_switch;
		unsigned char motion_detection_switch;
		unsigned char sdcard_lost_switch;
		unsigned char sdcard_format_error_switch;
		unsigned char sdcard_readwrite_error_switch;
		unsigned char harddisk_lost_switch;
		unsigned char harddisk_format_error_switch;
		unsigned char harddisk_readwrite_error_switch;
		unsigned char network_failure_switch;
		unsigned char outarea_switch;
		unsigned char inarea_switch;
		unsigned char leeway_switch;
		unsigned char upgrade_fails_switch;
		unsigned char speeding_switch;
		unsigned char long_idling_switch;
		unsigned char speed_openclose_door_switch;
		unsigned char external_io_interface_switch;
		unsigned char system_failure_switch;
		unsigned char vibration_limit_switch;
		unsigned char temperature_limit_switch;
		unsigned char voltage_protection_switch;
		unsigned char video_loss_level;
		unsigned char encoder_exception_level;
		unsigned char ptz_failure_level;
		unsigned char video_shielding_level;
		unsigned char motion_detection_level;
		unsigned char sdcard_lost_level;
		unsigned char sdcard_format_error_level;
		unsigned char sdcard_readwrite_error_level;
		unsigned char harddisk_lost_level;
		unsigned char harddisk_format_error_level;
		unsigned char harddisk_readwrite_error_level;
		unsigned char network_failure_level;
		unsigned char outarea_level;
		unsigned char inarea_level;
		unsigned char leeway_level;
		unsigned char upgrade_fails_level;
		unsigned char speeding_level;
		unsigned char long_idling_level;
		unsigned char speed_openclose_door_level;
		unsigned char external_io_interface_level;
		unsigned char system_failure_level;
		unsigned char vibration_limit_level;
		unsigned char temperature_limit_level;
		unsigned char voltage_protection_level;

		//ID : 0xa***
		//ptz parameter
		unsigned char ptz_switch_1;
		unsigned char ptz_protocol_1;
		unsigned char ptz_baud_rate_1;
		unsigned char ptz_set_wiper_1;
		unsigned char ptz_switch_2;
		unsigned char ptz_protocol_2;
		unsigned char ptz_baud_rate_2;
		unsigned char ptz_set_wiper_2;
		unsigned char ptz_switch_3;
		unsigned char ptz_protocol_3;
		unsigned char ptz_baud_rate_3;
		unsigned char ptz_set_wiper_3;
		unsigned char ptz_switch_4;
		unsigned char ptz_protocol_4;
		unsigned char ptz_baud_rate_4;
		unsigned char ptz_set_wiper_4;

		//ID : 0xb***
		//net information parameter
		unsigned short cmd_port;
		unsigned short data_port;
		unsigned short ftp_port;
		unsigned char server_ip[20];
		unsigned char server_dns[20];
		unsigned char server_gateway[20];

		//ID : 0xc***
		//gps parameter
		unsigned char gps_switch;
		unsigned char gps_ctrl_switch;
		unsigned char gps_addr[20];

		//model config
		unsigned char version_type;/*0 shows normal bus version; 1 shows common version; 2 shows xiamen bus version*/
		unsigned char image_data_format;/*0 shows original data; 1 shows normal/common version; 2 shows xiamen bus version*/
		
		//network parameter
		char APN_name[20];/*APN name*/
		char dial_number[20];/*dial number*/
		char user_name[20];/*user name*/
		char password[20];/*password*/
		char main_center_address[20];/*the main center address*/
		char sub_center_address[20];/*the sub center address, that is the same with main center normally*/
		unsigned short main_center_port;/*the main center port*/
		unsigned short sub_center_port;/*the sub center port*/

		//TCP setting
		unsigned char resend_times;/*the times of resending when platform dose not response. 0 shows no resend*/
		unsigned char resend_interval;/*the time interval of resending when platform dose not response. 0 shows no resend*/
		unsigned char beatheart_interval;/*the time interval of beatheart package. 0 shows no beatheart*/
		unsigned char move_interval;/*the time interval of sending realtime position information when moving*/
		unsigned char static_interval;/*the time interval of sending realtime position information when static*/

		//note model
		unsigned char note_switch;/*the switch of sending note, 1 shows open and 0 shows close*/
		char note_center_number[20];/*the telephone number of note center*/
		char center_note_receive_number[20];/*the telephone number that is target telephone number*/
		unsigned short note_interval;/*the time interval of sending note of position information when TCP connection is disconnected*/

		//telephone operation
		unsigned short total_limit_time;/*the total calling time that contains dial time and answer time, the unit is minute*/
		unsigned char answer_flag;/*the flag of answering call at any time. 1 shows enable and 0 shows answer call when center send instruction*/
		unsigned char answer_type;/*1 shows automatic and 0 shows manual*/

		//black box config
		unsigned char function_switch;/*the function switch of black box. 0 shows close, 1 shows store in device, 2 shows store in SD card*/
		unsigned char gps_sampling_interval;/*the time interval of sampling gps information*/

		//transparent serial port
		unsigned char function_port5;/*the function of port 5, 0 shows unable, 1 shows transparent transmittion and 2 shows connect temperature sensor*/
		unsigned char rate_port5;/*the rate of port 5, 0 shows 300, 1 shows 600, 2 shows 1200, 3 shows 2400, 4 shows 4800, 5 shows 9600, 6 shows 19200, 7 shows 38400, 8 shows 57600, 9 shows 115200*/

		//GPIO config
		unsigned char door_switch;/*check the door is closed or opened. 0 shows no checking and 1 shows check*/
		unsigned char door_snap_switch;/*snapping when the door is closed or opened. 0 shows no snapping and 1 shows automatically snap*/

		/*intelligent audio prompt setting*/
		unsigned char audio_times;/*the times of playing scheduling audio. default is 1*/
		unsigned char short_message_times;/*the times of playing short message. default is 1*/
		unsigned char audio_overspeed_times;/*the times of playing overspeed audio. default is 0*/
		unsigned char audio_door_times;/*the times of playing close/open door audio. default is 0*/
		char audio_pre_schedul[100];/*the content of playing audio of pre scheduling. default is NULL*/
		char audio_pre_short_message[100];/*the content of playing audio of pre short message. default is NULL*/
		char audio_overspeed_message[100];/*the content of playing audio of overspeed alarm. default is overspeed, please slow down*/
		char audio_door_message[100];/*the content of playing audio of closing door. default is please close attention*/

		/*other config*/
		unsigned char switch_check_sd;/*enable sd card checking function, if sd card dose not exist then restart video model. 1 shows enable and 0 shows unable. default is 1*/
		unsigned char switch_gps;/*the switch of using gps switch. 1 shows use and 0 shows no use. default is 1*/
		unsigned char limit_speed;/*the limit value of speeding. the unit is km/h*/
		unsigned char alarm_time;/*the time of alarm continues. for exampl, after 2s after alarm occurs, send alarm to platform*/
		unsigned short stop_overtime;/*the overtime of stopping, the unit is second*/
		unsigned char interface_type;/*the interface type of LED, 0 shows no use, 1 shows 1-RS232, 2 shows 485, 3 shows 232 and 485. default is 2*/
		unsigned char line_extend;/*the extend of line number. 0 shows no extend(8 bits), 1 shows extend(9 bit)*/
		unsigned short gps_data_count;/*the counter of gps data in buffer of device. default is 0. the scope is 0-10000*/
		unsigned char backdoor_video;/*the flag of sending backdoor video when door is opened. 0 shows no sending and 1 shows sending. default is 0*/

		//station config
		unsigned char station_type;/*the type of LED station. 0 shows no use and 1 shows xiaoke station*/

		//WIFI client config
		unsigned char wifi_function_switch;/*the switch of WIFI function 0 shows enable and 1 shows unable. default is 0*/
		char vifi_ip_address[20];/*the local ip address of WIFI client, default is NULL*/
		char vifi_ip_gateway[20];/*the local ip gateway of WIFI client, default is NULL*/
		char vifi_AP_name1[20];/*the AP name1 of WIFI, default is NULL*/
		char vifi_AP_password1[20];/*the AP password1 of WIFI, default is NULL*/
		char vifi_AP_name2[20];/*the AP name2 of WIFI, default is NULL*/
		char vifi_AP_password2[20];/*the AP password2 of WIFI, default is NULL*/

	public:
		Parameter_config();/*constructed function*/
		~Parameter_config();/*deconstructed function*/
	public:
		/*set,get member functin*/
		void set_version_type(unsigned char temp_version_type);/*set version type. 0 shows normal bus version; 1 shows common version; 2 shows xiamen bus version*/
		unsigned char get_version_type();/*get version type. 0 shows normal bus version; 1 shows common version; 2 shows xiamen bus version*/
		void set_image_data_format(unsigned char temp_image_data_format);/*set image data format. 0 shows original data; 1 shows normal/common version; 2 shows xiamen bus version*/
		unsigned char get_image_data_format();/*get image data format. 0 shows original data; 1 shows normal/common version; 2 shows xiamen bus version*/
		void set_APN_name(unsigned char *temp_APN_name, unsigned char data_size);/*set APN name*/
		void get_APN_name(unsigned char *temp_APN_name);/*get APN name*/
		void set_dial_number(unsigned char *temp_dial_number, unsigned char data_size);/*set dial number*/
		void get_dial_number(unsigned char *temp_dial_number);/*get dial number*/
		void set_user_name(unsigned char *temp_user_name, unsigned char data_size);/*set user name*/
		void get_user_name(unsigned char *temp_user_name);/*get user name*/
		void set_password(unsigned char *temp_password, unsigned char data_size);/*set password*/
		void get_password(unsigned char *temp_password);/*get password*/
		void set_main_center_address(unsigned char *temp_main_center_address, unsigned char data_size);/*set the main center address*/
		void get_main_center_address(unsigned char *temp_main_center_address);/*get the main center address*/
		void set_sub_center_address(unsigned char *temp_sub_center_address, unsigned char data_size);/*set the sub center address, that is the same with main center normally*/
		void get_sub_center_address(unsigned char *temp_sub_center_address);/*get the sub center address, that is the same with main center normally*/
		void set_main_center_port(unsigned short temp_main_center_port);/*set the main center port*/
		unsigned short get_main_center_port();/*get the main center port*/
		void set_sub_center_port(unsigned short temp_sub_center_port);/*set the sub center port*/
		unsigned short get_sub_center_port();/*get the sub center port*/
		void set_resend_times(unsigned char temp_resend_times);/*set the times of resending when platform dose not response. 0 shows no resend*/
		unsigned char get_resend_times();/*get the times of resending when platform dose not response. 0 shows no resend*/
		void set_resend_interval(unsigned char temp_resend_interval);/*set the time interval of resending when platform dose not response. 0 shows no resend*/
		unsigned char get_resend_interval();/*get the time interval of resending when platform dose not response. 0 shows no resend*/
		void set_beatheart_interval(unsigned char temp_beatheart_interval);/*set the time interval of beatheart package. 0 shows no beatheart*/
		unsigned char get_beatheart_interval();/*get the time interval of beatheart package. 0 shows no beatheart*/
		void set_move_interval(unsigned char temp_move_interval);/*set the time interval of sending realtime position information when moving*/
		unsigned char get_move_interval();/*get the time interval of sending realtime position information when moving*/
		void set_static_interval(unsigned char temp_static_interval);/*set the time interval of sending realtime position information when static*/
		unsigned char get_static_interval();/*get the time interval of sending realtime position information when static*/
		void set_note_switch(unsigned char temp_note_switch);/*set the switch of sending note, 1 shows open and 0 shows close*/
		unsigned char get_note_switch();/*get the switch of sending note, 1 shows open and 0 shows close*/
		void set_note_center_number(unsigned char *temp_note_center_number, unsigned char data_size);/*set the telephone number of note center*/
		void get_note_center_number(unsigned char *temp_note_center_number);/*get the telephone number of note center*/
		void set_center_note_receive_number(unsigned char *temp_center_note_receive_number, unsigned char data_size);/*set the telephone number that is target telephone number*/
		void get_center_note_receive_number(unsigned char *temp_center_note_receive_number);/*get the telephone number that is target telephone number*/
		void set_note_interval(unsigned short temp_note_interval);/*set the time interval of sending note of position information when TCP connection is disconnected*/
		unsigned short get_note_interval();/*get the time interval of sending note of position information when TCP connection is disconnected*/
		void set_total_limit_time(unsigned short temp_total_limit_time);/*set the total calling time that contains dial time and answer time, the unit is minute*/
		unsigned short get_total_limit_time();/*get the total calling time that contains dial time and answer time, the unit is minute*/
		void set_answer_flag(unsigned char temp_answer_flag);/*set the flag of answering call at any time. 1 shows enable and 0 shows answer call when center send instruction*/
		unsigned char get_answer_flag();/*get the flag of answering call at any time. 1 shows enable and 0 shows answer call when center send instruction*/
		void set_answer_type(unsigned char temp_answer_type);/*set the type of answer calling. 1 shows automatic and 0 shows manual*/
		unsigned char get_answer_type();/*get the type of answer calling. 1 shows automatic and 0 shows manual*/
		void set_function_switch(unsigned char temp_function_switch);/*set the function switch of black box. 0 shows close, 1 shows store in device, 2 shows store in SD card*/
		unsigned char get_function_switch();/*get the function switch of black box. 0 shows close, 1 shows store in device, 2 shows store in SD card*/
		void set_gps_sampling_interval(unsigned char temp_gps_sampling_interval);/*set the time interval of sampling gps information*/
		unsigned char get_gps_sampling_interval();/*get the time interval of sampling gps information*/
		void set_function_port5(unsigned char temp_function_port5);/*set the function of port 5, 0 shows unable, 1 shows transparent transmittion and 2 shows connect temperature sensor*/
		unsigned char get_function_port5();/*get the function of port 5, 0 shows unable, 1 shows transparent transmittion and 2 shows connect temperature sensor*/
		void set_rate_port5(unsigned char temp_rate_port5);/*set the rate of port 5, 0 shows 300, 1 shows 600, 2 shows 1200, 3 shows 2400, 4 shows 4800, 5 shows 9600, 6 shows 19200, 7 shows 38400, 8 shows 57600, 9 shows 115200*/
		unsigned char get_rate_port5();/*get the rate of port 5, 0 shows 300, 1 shows 600, 2 shows 1200, 3 shows 2400, 4 shows 4800, 5 shows 9600, 6 shows 19200, 7 shows 38400, 8 shows 57600, 9 shows 115200*/
		void set_door_switch(unsigned char temp_door_switch);/*set the door switch, check the door is closed or opened. 0 shows no checking and 1 shows check*/
		unsigned char get_door_switch();/*get the door switch, check the door is closed or opened. 0 shows no checking and 1 shows check*/
		void set_door_snap_switch(unsigned char temp_door_snap_switch);/*set the switch of door snap, snapping when the door is closed or opened. 0 shows no snapping and 1 shows automatically snap*/
		unsigned char get_door_snap_switch();/*get the switch of door snap, snapping when the door is closed or opened. 0 shows no snapping and 1 shows automatically snap*/
		void set_audio_times(unsigned char temp_audio_times);/*set the times of playing scheduling audio. default is 1*/
		unsigned char get_audio_times();/*get the times of playing scheduling audio. default is 1*/
		void set_short_message_times(unsigned char temp_short_message_times);/*set the times of playing short message. default is 1*/
		unsigned char get_short_message_times();/*get the times of playing short message. default is 1*/
		void set_audio_overspeed_times(unsigned char temp_audio_overspeed_times);/*set the times of playing overspeed audio. default is 0*/
		unsigned char get_audio_overspeed_times();/*get the times of playing overspeed audio. default is 0*/
		void set_audio_door_times(unsigned char temp_audio_door_times);/*set the times of playing close/open door audio. default is 0*/
		unsigned char get_audio_door_times();/*get the times of playing close/open door audio. default is 0*/
		void set_audio_pre_schedul(unsigned char *temp_audio_pre_schedul, unsigned char data_size);/*set the content of playing audio of pre scheduling. default is NULL*/
		void get_audio_pre_schedul(unsigned char *temp_audio_pre_schedul);/*get the content of playing audio of pre scheduling. default is NULL*/
		void set_audio_pre_short_message(unsigned char *temp_audio_pre_short_message, unsigned char data_size);/*set the content of playing audio of pre short message. default is NULL*/
		void get_audio_pre_short_message(unsigned char *temp_audio_pre_short_message);/*set the content of playing audio of pre short message. default is NULL*/
		void set_audio_overspeed_message(unsigned char *temp_audio_overspeed_message, unsigned char data_size);/*set the content of playing audio of overspeed alarm. default is overspeed, please slow down*/
		void get_audio_overspeed_message(unsigned char *temp_audio_overspeed_message);/*get the content of playing audio of overspeed alarm. default is overspeed, please slow down*/
		void set_audio_door_message(unsigned char *temp_audio_door_message, unsigned char data_size);/*set the content of playing audio of closing door. default is please close attention*/
		void get_audio_door_message(unsigned char *temp_audio_door_message);/*get the content of playing audio of closing door. default is please close attention*/
		void set_switch_check_sd(unsigned char temp_switch_check_sd);/*enable sd card checking function, if sd card dose not exist then restart video model. 1 shows enable and 0 shows unable. default is 1*/
		unsigned char get_switch_check_sd();/*enable sd card checking function, if sd card dose not exist then restart video model. 1 shows enable and 0 shows unable. default is 1*/
		void set_switch_gps(unsigned char temp_switch_gps);/*set the switch of using gps switch. 1 shows use and 0 shows no use. default is 1*/
		unsigned char get_switch_gps();/*get the switch of using gps switch. 1 shows use and 0 shows no use. default is 1*/
		void set_limit_speed(unsigned char temp_limit_speed);/*set the limit value of speeding. the unit is km/h*/
		unsigned char get_limit_speed();/*get the limit value of speeding. the unit is km/h*/
		void set_alarm_time(unsigned char temp_alarm_time);/*set the time of alarm continues. for exampl, after 2s after alarm occurs, send alarm to platform*/
		unsigned char get_alarm_time();/*get the time of alarm continues. for exampl, after 2s after alarm occurs, send alarm to platform*/
		void set_stop_overtime(unsigned short temp_stop_overtime);/*set the overtime of stopping, the unit is second*/
		unsigned short get_stop_overtime();/*get the overtime of stopping, the unit is second*/
		void set_interface_type(unsigned char temp_interface_type);/*set the interface type of LED, 0 shows no use, 1 shows 1-RS232, 2 shows 485, 3 shows 232 and 485. default is 2*/
		unsigned char get_interface_type();/*get the interface type of LED, 0 shows no use, 1 shows 1-RS232, 2 shows 485, 3 shows 232 and 485. default is 2*/
		void set_line_extend(unsigned char temp_line_extend);/*set the extend of line number. 0 shows no extend(8 bits), 1 shows extend(9 bit)*/
		unsigned char get_line_extend();/*get the extend of line number. 0 shows no extend(8 bits), 1 shows extend(9 bit)*/
		void set_gps_data_count(unsigned short temp_gps_data_count);/*set the counter of gps data in buffer of device. default is 0. the scope is 0-10000*/
		unsigned short get_gps_data_count();/*get the counter of gps data in buffer of device. default is 0. the scope is 0-10000*/
		void set_backdoor_video(unsigned char temp_backdoor_video);/*set the flag of sending backdoor video when door is opened. 0 shows no sending and 1 shows sending. default is 0*/
		unsigned char get_backdoor_video();/*get the flag of sending backdoor video when door is opened. 0 shows no sending and 1 shows sending. default is 0*/
		void set_station_type(unsigned char temp_station_type);/*set the type of LED station. 0 shows no use and 1 shows xiaoke station*/
		unsigned char get_station_type();/*get the type of LED station. 0 shows no use and 1 shows xiaoke station*/
		void set_wifi_function_switch(unsigned char temp_wifi_function_switch);/*set the switch of WIFI function 0 shows enable and 1 shows unable. default is 0*/
		unsigned char get_wifi_function_switch();/*get the switch of WIFI function 0 shows enable and 1 shows unable. default is 0*/
		void set_vifi_ip_address(unsigned char *temp_vifi_ip_address, unsigned char data_size);/*set the local ip address of WIFI client, default is NULL*/
		void get_vifi_ip_address(unsigned char *temp_vifi_ip_address);/*get the local ip address of WIFI client, default is NULL*/
		void set_vifi_ip_gateway(unsigned char *temp_vifi_ip_gateway, unsigned char data_size);/*set the local ip gateway of WIFI client, default is NULL*/
		void get_vifi_ip_gateway(unsigned char *temp_vifi_ip_gateway);/*get the local ip gateway of WIFI client, default is NULL*/
		void set_vifi_AP_name1(unsigned char *temp_vifi_AP_name1, unsigned char data_size);/*set the AP name1 of WIFI, default is NULL*/
		void get_vifi_AP_name1(unsigned char *temp_vifi_AP_name1);/*get the AP name1 of WIFI, default is NULL*/
		void set_vifi_AP_password1(unsigned char *temp_vifi_AP_password1, unsigned char data_size);/*set the AP password1 of WIFI, default is NULL*/
		void get_vifi_AP_password1(unsigned char *temp_vifi_AP_password1);/*get the AP password1 of WIFI, default is NULL*/
		void set_vifi_AP_name2(unsigned char *temp_vifi_AP_name2, unsigned char data_size);/*set the AP name2 of WIFI, default is NULL*/
		void get_vifi_AP_name2(unsigned char *temp_vifi_AP_name2);/*get the AP name2 of WIFI, default is NULL*/
		void set_vifi_AP_password2(unsigned char *temp_vifi_AP_password2, unsigned char data_size);/*set the AP password2 of WIFI, default is NULL*/
		void get_vifi_AP_password2(unsigned char *temp_vifi_AP_password2);/*get the AP password2 of WIFI, default is NULL*/
		/*set,get member functin end*/
		
	public:
		/*basic function*/
		bool Video_Para_Read(videoItem item[]);/*read video parameter*/
		bool Ptz_Para_Read(ptzItem item[]);/*read ptz parameter*/
		unsigned long Do_Terminal_Param(unsigned short paramID, unsigned char *data, unsigned char len, char *buf, unsigned long buf_len);
		bool Resolve_Terminal_Para(unsigned char *data);/*resolve all parameter*/
		int UpdateParameter(const char * name, void * value, char * buf,  unsigned long buf_len, int type);
		bool UpdateParameter_short(const char * name, unsigned short value[], int type);
		void extract_data(char *line,char *temp);
		bool Record_Format_Para_Read(recordFormatItem item[]);
		bool Net_Para_Read(netItem * item);
		bool Record_Storage_Para_Read(recordStorageItem * item);
		bool Osd_Para_Read(osdItem item[]);
		bool TerminalInformation_Para_Read(terminalInformationItem * item, unsigned char *device_model_len, unsigned char *manufacturer_len, unsigned char *software_version_len, unsigned char *hardware_version_len);
		unsigned long get_file_size(const char *filename);
		unsigned short buftou16(unsigned char *src);
		unsigned int buftou32(unsigned char *src);
		int recover_config_file();
		int doc2hex(int src);
		void u16tobuf(unsigned char *dst, unsigned short src);
		bool is_file(const char *path);
		int copy_file(char *src_file, char *dst_file);
		bool Resolve_Terminal_Para_2_tmp(unsigned char *data);
		/*basic function end*/
};

#endif

